package com.panshi.config;

import com.panshi.domain.vo.ZxResult;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * 方便Controller返回数据到前台
 */
@Configuration
public class MyControllerReturnUtls {

    public static ZxResult ControllerReturn(List list) {
        if (list.size() > 0) {
            return new ZxResult(200, "操作成功", list);
        } else {
            return new ZxResult(400, "操作失败", null);
        }
    }

    public static ZxResult ControllerReturn(int n) {
        if (n > 0) {
            return new ZxResult(200, "操作成功", n);
        } else {
            return new ZxResult(400, "操作失败", null);
        }
    }
}
